< previous page page_275 next page >

Page 275
8694cbadb9b1ef7075903f6f95fc1db2.gif
When the Data control is assigned to a recordset created with the ActiveX Data Objects
8694cbadb9b1ef7075903f6f95fc1db2.gif
To retrieve any additions, modifications, or deletions that might have been made to the data
The Update method forces the data in the bound controls to be saved to the recordset. Typically, you would have a Save or Update button on the form to execute this method, so users can save their work on the current record without having to move to another record.
The UpdateControls method redisplays the data from the current record in the bound controls. This method cancels any changes that users might have made but haven't saved yet.
ActiveX Data Objects
Now that you've seen how to access database information with Visual Basic's new ActiveX Data Control and bound controls, you can see how to use the ActiveX Data Objects to program complex database functions into your application. Visual Basic's ActiveX Data Objects (ADO) can be used to create complete database applications. ActiveX Data Objects act as an application's internal representation of the physical data stored in some type of database or data management system. The Data Objects can be thought of as special types of program variables. These variables represent data stored outside the application, rather than data stored in the computer's memory while the application is running.
ADO and programming code also provide the structure for many actions used by the Data control and the bound controls to access the database. To see the similarities and differences between ADO and the ADODC, you'll create the same data form as the one you created by using the Data control.
The main reason for using ActiveX Data Objects is the flexibility they give you over and above what's available with the Data control. You can perform more complex input validation than is possible with just the data engine because the commands don't directly access the database. You can also cancel changes to your edited data without using transactions. Using ADO commands also provides an efficient way to handle data input and searches that don't require user interaction. An example is looking up the price of an item in a table for the ordering process. ADO commands also allow you to do transaction processing when vneeded.

 
< previous page page_275 next page >

If you like this book, buy it!